# -*- mode: python ; coding: utf-8 -*-
import os

# 定义图片目录路径
image_dir = 'D:\\IdeaProjects\\python\\pk\\image'
# 初始化 datas 列表
datas = []
# 遍历图片目录及其子目录
for root, dirs, files in os.walk(image_dir):
    for file in files:
        if file.lower().endswith(('.png', '.jpg', '.jpeg')):
            # 获取文件的完整路径
            file_path = os.path.join(root, file)
            # 计算相对路径
            relative_path = os.path.relpath(root, os.path.dirname(image_dir))
            # 将文件路径和相对目标路径添加到 datas 列表
            datas.append((file_path, relative_path))

a = Analysis(
    ['__init__.py'],
    pathex=[],
    binaries=[],
    datas=datas,
    hiddenimports=['mysql.connector', 'tkinter', 'win32gui', 'win32con', 'win32ui', 'pynput', 'cv2', 'numpy'],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False
)
pyz = PYZ(a.pure)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='mh助手',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=False,  # Windows 7 可能对 UPX 压缩有兼容性问题，禁用 UPX
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
